package com.itheima.myBigDecimal;

import java.math.BigDecimal;
import java.util.Scanner;

public class mybigdecimal {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一个数");
        String s1 = sc.next();
        BigDecimal b1 = new BigDecimal(s1);
        System.out.println("请输入第二个数");
        String s2 = sc.next();
        BigDecimal b2 = new BigDecimal(s2);

        System.out.println("请选择以下要进行的运算操作");
        while (true) {
            System.out.println("【1.加  2.减  3.乘  4.除】");
            String choice = sc.next();
            switch (choice) {
                case "1":
                    System.out.println(s1 + " + " + s2 + " = " + (b1.add(b2)));
                    break;
                case "2":
                    System.out.println(s1 + " - " + s2 + " = " + (b1.subtract(b2)));
                    break;
                case "3":
                    System.out.println(s1 + " * " + s2 + " = " + (b1.multiply(b2)));
                    break;
                case "4":
                    System.out.println(s1 + " / " + s2 + " = " + (b1.divide(b2)));
                    break;
                default:
                    System.out.println("输入有误,请重新选择");
                    break;
            }
        }
    }

}
